package cn.jxau.bean.vo;

import org.apache.log4j.Logger;

import cn.jxau.bean.po.User;

/**
 * 该vo对象代表一封邮件
 * @author licho
 *
 */
public class Email {
	private static Logger log=Logger.getLogger(Email.class);
	private String reciver;//接收者邮箱
	private String nickName="";//发送者昵称
	private String  subject;//邮件主题
	private StringBuilder content;//邮件内容
	/**
	 * 设置接收者创建一封emali
	 * @param reciver
	 */
	public Email(String reciver){
		this.reciver=reciver;
		this.content=new StringBuilder();
	}
	public Email(String reciver,String content){
		this.reciver=reciver;
		this.content=new StringBuilder(content);
	}
	public String getReciver() {
		return reciver;
	}
	public void setReciver(String reciver) {
		this.reciver = reciver;
	}
	public String getSubject() {
		return subject;
	}
	public void setSubject(String subject) {
		this.subject = subject;
	}
	public String getContent(){
		return this.content.toString();
	}
	/**
	 * 追加邮件内容
	 * @return
	 */
	public void appendContent(String content){
		this.content.append(content);
	}
	
	public String getNickName() {
		return nickName;
	}
	public void setNickName(String nickName) {
		this.nickName = nickName;
	}
	/**
	 * 获取一封邮箱验证码验证邮件
	 * @param User	向某个用户发送邮件
	 * @param code 验证码
	 * @return
	 */
	public static Email getValidateEmali(User user,String code){
		Email emali=new Email(user.getEmail());
		emali.setNickName(user.getName()+"用户");
		emali.setSubject("美文驿站邮箱验证码");
		emali.appendContent("亲爱的");
		emali.appendContent(user.getName());
		emali.appendContent("用户您好，您的邮箱验证码为:");
		emali.appendContent(code);
		emali.appendContent(",该验证码10分钟内有效！");
		return emali;
	}
	
}
